<template>
  <div class="app-container">
    <el-form :inline="true" :model="formInline" class="demo-form-inline">
      <el-row>
        <el-col :span="24">
          <el-form-item label="订单比那好：">
            <el-input size="mini" v-model="formInline.user" placeholder="请输入" />
          </el-form-item>
          <el-form-item label="预约门店：">
            <el-input size="mini" v-model="formInline.user" placeholder="请输入" />
          </el-form-item>
          <el-form-item label="下单时间：">
            <el-input size="mini" v-model="formInline.user" placeholder="请输入" />
          </el-form-item>
          <el-form-item label="订单状态：">
            <el-input size="mini" v-model="formInline.user" placeholder="请输入" />
          </el-form-item>
          <el-form-item>
            <el-button size="mini" type="primary" @click="onSubmit">查询</el-button>
            <el-button size="mini" @click="onReset">重置</el-button>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <el-table ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: 100%">
      <el-table-column label="订单编号">
        <template slot-scope="scope">
          <el-button type="text" @click="gotoDetail(scope.row.id)">北京移动</el-button>
        </template>
      </el-table-column>
      <el-table-column prop="name" label="下单时间"></el-table-column>
      <el-table-column prop="name" label="预约门店"></el-table-column>
      <el-table-column prop="name" label="预约时间"></el-table-column>
      <el-table-column prop="name" label="预约码"></el-table-column>
      <el-table-column prop="name" label="检查类型"></el-table-column>
      <el-table-column prop="name" label="订单状态"></el-table-column>
      <el-table-column prop="name" label="应付金额"></el-table-column>
      <el-table-column prop="name" label="实付金额"></el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button type="text" @click="gotoDetail(scope.row.id)">详情</el-button>
          <el-button type="text" @click="onClose">关闭交易</el-button>
          <el-button type="text" @click="onRefund">售后退款</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div class="pagination">
      <!-- 分页组件 -->
    </div>
    <el-dialog title="修改" :visible.sync="dialogVisible" width="40%">
      <el-row :gutter="20">
        <el-col :span="8">订单编号:111</el-col>
        <el-col :span="8">订单状态:111</el-col>
        <el-col :span="8">下单时间:111</el-col>
        <el-col :span="8">订单客户:111</el-col>
        <el-col :span="8">联系方式:111</el-col>
        <el-col :span="8">所在城市:111</el-col>
      </el-row>
      <div>详细信息</div>
      <el-row :gutter="20">
        <el-col :span="12">预约码:111</el-col>
        <el-col :span="12">预约门店:111</el-col>
        <el-col :span="12">体检项目总价:111</el-col>
        <el-col :span="12">实付金额:111</el-col>
        <el-col :span="12">优惠卷抵扣金额:111</el-col>
        <el-col :span="12">优惠卷编号:111</el-col>
        <el-col :span="12">退款账户:111</el-col>
        <el-col :span="12">账户类型:111</el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="24">退款原因</el-col>
        <el-col :span="24">
          <el-input type="textarea" placeholder="请输入内容" v-model="val" />
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="12">退款金额:2000</el-col>
        <el-col :span="12">是否退优惠卷</el-col>
        <el-col :span="24">请注意：最多退款2000，优惠券退回到优惠券账户！</el-col>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <el-button size="mini" @click="dialogVisible = false">取 消</el-button>

        <el-button size="mini" type="primary" @click="onSubmit">申请退款</el-button>
      </span>
    </el-dialog>

    <el-dialog :visible.sync="dialogClose" width="40%">
      <el-row :gutter="20">
        <el-col :span="8">订单编号:111</el-col>
        <el-col :span="8">订单状态:111</el-col>
        <el-col :span="8">下单时间:111</el-col>
        <el-col :span="8">订单客户:111</el-col>
        <el-col :span="8">联系方式:111</el-col>
        <el-col :span="8">所在城市:111</el-col>
      </el-row>
      <div>预约检查信息</div>
      <el-table ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: 100%">
        <el-table-column prop="name" label="受检者"></el-table-column>
        <el-table-column prop="name" label="受检者联系方式"></el-table-column>
        <el-table-column prop="name" label="预约门店"></el-table-column>
        <el-table-column prop="name" label="预约时间"></el-table-column>
        <el-table-column prop="name" label="预约状态"></el-table-column>
      </el-table>
      <el-row :gutter="20">
        <el-col :span="24">退关闭交易理由</el-col>
        <el-col :span="24">
          <el-input type="textarea" placeholder="请输入内容" v-model="val" />
        </el-col>
      </el-row>

      <span slot="footer" class="dialog-footer">
        <el-button size="mini" @click="dialogClose = false">取消</el-button>

        <el-button size="mini" type="primary" @click="dialogClose = false">确定关闭交易</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    const generateData = _ => {
      const data = []
      for (let i = 1; i <= 15; i++) {
        data.push({
          key: i,
          label: `备选项 ${i}`,
          disabled: i % 4 === 0
        })
      }
      return data
    }
    return {
      data: generateData(),
      arr: [],
      val: '',
      value1: '',
      dialogVisible: false,
      dialogClose: false,
      value: true,

      options: [
        {
          value: '选项1',
          label: '待审批'
        },
        {
          value: '选项2',
          label: '已审批'
        },
        {
          value: '选项3',
          label: '已下载'
        },
        {
          value: '选项4',
          label: '已兑换'
        },
        {
          value: '选项5',
          label: '已过兑换期'
        },
        {
          value: '选项6',
          label: '已过使用期'
        },
        {
          value: '选项7',
          label: '已作废'
        }
      ],
      input: '',
      formInline: {
        user: '',
        region: '',
        val: ''
      },
      tableData: [
        {
          date: '2016-05-03',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1518 弄'
        }
      ],
      multipleSelection: []
    }
  },
  methods: {
    handleSelectionChange(val) {
      this.multipleSelection = val
    },
    onSubmit() {
      this.$notify({
        title: '成功',
        message: '这是一条成功的提示消息',
        type: 'success'
      })
      this.dialogVisible = false
    },
    onRefund() {
      this.dialogVisible = true
    },
    onClose() {
      this.dialogClose = true
    },
    gotoDetail(val) {
      this.$router.push({ path: 'orderDetail' })
    },
    onReset() {
      this.formInline = {
        user: '',
        region: '',
        val1: '',
        val2: ''
      }
    },
    onCancel() {
      this.$message({
        message: 'cancel!',
        type: 'warning'
      })
    },
    handleCurrentChange(row, event, column) {
      console.log(row, event, column, event.currentTarget)
    },
    handleEdit(index, row) {
      console.log(index, row)
    },
    handleDelete(index, row) {
      console.log(index, row)
    }
  }
}
</script>

<style scoped>
.line {
  text-align: center;
}
.el-col {
  margin-bottom: 20px;
}
.el-input {
  height: 33px;
  font-size: 13px;
  box-shadow: none;
  border: 1px solid #e9e9e9;
}
</style>

